import 'package:json_annotation/json_annotation.dart';

part 'PPShopHomePageModel.g.dart';

@JsonSerializable()
class PPShopPlateContent {

    PPShopPlateContent(
        this.id, 
        this.redirectUrlH5, 
        this.cmmdtyCode,
        this.plateId,
        this.url,
        this.contentDesc,
        this.redirectUrl
    );

    int id;
    String redirectUrlH5;
    String cmmdtyCode;
    int plateId;
    String url;
    String contentDesc;
    String redirectUrl;

    //不同的类使用不同的mixin即可
    factory PPShopPlateContent.fromJson(Map<String, dynamic> json) => _$PPShopPlateContentFromJson(json);
    Map<String, dynamic> toJson() => _$PPShopPlateContentToJson(this);
}

@JsonSerializable()
class PPCommodityModel {
    PPCommodityModel(
        this.cmmdtyCode, 
        this.activityId, 
        this.cmmdtyName, 
        this.cmmdtyTagList,
        this.canSale,
        this.cmmtdyPrice,
        this.priceTypel,
        this.defaultInstInfo,
        this.cmmtdyPicUrl,
        this.promotionInfoList
    );

    String cmmdtyCode;
    String activityId;
    String cmmdtyName;
    List<String> cmmdtyTagList;
    String canSale;
    String cmmtdyPrice;
    String priceTypel;
    String defaultInstInfo;
    String cmmtdyPicUrl;
    List<Map<String, String>> promotionInfoList;

    factory PPCommodityModel.fromJson(Map<String, dynamic> json) => _$PPCommodityModelFromJson(json);
    Map<String, dynamic> toJson() => _$PPCommodityModelToJson(this);
}

@JsonSerializable()
class PPShopPlate {

    PPShopPlate(
        this.id, 
        this.plateHeight, 
        this.plateName, 
        this.plateType,
        this.contentList,
        this.cmmdtyList
    );

    int id;
    double plateHeight;
    String plateName;
    String plateType;
    List<PPShopPlateContent> contentList;
    List<PPCommodityModel> cmmdtyList;

    //不同的类使用不同的mixin即可
    factory PPShopPlate.fromJson(Map<String, dynamic> json) => _$PPShopPlateFromJson(json);
    Map<String, dynamic> toJson() => _$PPShopPlateToJson(this);
}
